package ThreadTest;

public class TestDemo2 {
    public static void main(String[] args) {
        Object object = new Object();
        Thread thread = new Thread(()-> {
            synchronized (object) {
                try {
                    object.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("Hello thread");
            }
        });
        thread.start();
        Thread thread1 = new Thread(()->{
            thread.interrupt();
        });
        thread1.start();
    }
}
